package top.serms.leetcode;

/**
 * 无序数组，求arr[L...R]范围上最大值   N
 */
public class Code08_GetMax {
    public static int getMax(int[] arr) {
        return process(arr, 0, arr.length - 1);
    }

    private static int process(int[] arr, int L, int R) {
        if(L == R) return arr[L];
        int mid = L + ((R-L) >> 1);
        int lefMax = process(arr,L ,mid);
        int rightMax  = process(arr,mid+1,R);
        return Math.max(lefMax,rightMax);
    }
}
